package com.weu.mapper;

import com.weu.bean.Brand;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface BrandMapper {

    /**
     * 查询所有品牌
     *
     * @return
     */
    @Select("select * from ilmc_brand")
    public List<Brand> getAll();

    /**
     * 查询指定ID的品牌
     *
     * @param id
     * @return
     */
    @Select("select * from ilmc_brand where brand_id=#{id}")
    public Brand getOne(int id);

    /**
     * 根据品牌ID删除指定品牌
     *
     * @param id
     * @return
     */
    @Delete("delete from ilmc_brand where brand_id=#{id}")
    public int delById(int id);

    /**
     * 修改品牌
     *
     * @param brand
     * @return
     */
    @Update("update ilmc_brand set brand_name = #{brandName} where brand_id = #{brandId}")
    public int updateBrand(Brand brand);

    /**
     * 保存品牌
     *
     * @param brand
     * @return
     */
    @Insert("insert into ilmc_brand(brand_name) values(#{brandName})")
    public int saveBrand(Brand brand);

}
